﻿using System;
using System.Data;
using Kangaroo.Deferreds;
using Kangaroo.Model;

namespace Kangaroo.IDAL
{
    public interface ISignal
    {
        #region Synchronous methods

        ChannelInfo[] ListChannels();

        ChannelInfo GetLatestChannel();

        SignalInfo[] ListTimePointsOfChannel(ChannelInfo channel);

        // TODO: Add test
        SignalInfo GetSignal(Int64 key);

        SignalInfo[] ListSignals();

        SignalInfo[] ListSignalsOfChannel(ChannelInfo channel);

        DataTable ListSignalsByChannelWithinTime(int channelKey, DateTime startTime, DateTime endTime);

        #endregion

        #region Asynchronous methods

        IDeferred<ChannelInfo[]> ListChannelsAsync();
        
        IDeferred<SignalInfo[]> ListTimePointsOfChannelAsync(ChannelInfo channel);
        
        IDeferred<SignalInfo> GetSignalAsync(Int64 key);
        
        IDeferred<SignalInfo[]> ListSignalsAsync();

        IDeferred<SignalInfo[]> ListSignalsOfChannelAsync(ChannelInfo channel);

        IDeferred<DataTable> ListSignalsByChannelWithinTimeAsync(
            int channelKey, DateTime startTime, DateTime endTime);

        #endregion
    }
}